#ifndef TRUCK_H_
#define TRUCK_H_

#include "sceneObject.h"
#include "chasis.h"
#include "tire.h"
#include "../actions/gravity.h"

class Truck : public SceneObject , public Solid{
	private:
		static const float maxSpeed;
		static const unsigned int movingTicks;
		static const float accel;
		static const float rotationAngle;

		typedef enum{ STOPPED,ACCEL,DESAC,MOVING } MotionState;
		typedef enum{ LEFT=-1,RIGHT=1 } MotionVector;

		struct State{
			MotionState motion;
			MotionVector dir;
			unsigned int currTicks;

			State(){
				this->motion = STOPPED;
				this->dir = LEFT;
				this->currTicks = 0;
			}
		};

		State state;
		bool loaded;
		bool leaving;
	public:
		Truck(Rectangle chasisRec,Rectangle loadAreaRec);
		~Truck();

		void goLeftLimit();
		void goRightLimit();

		bool isStopped();
		bool isMoving();

		void draw();
		void timeStep();

		void move(float dx,float dy);

		virtual void accelerate(float accel){}

		void notifyCollision(Solid* obj);

		static std::string name(){
			return "truck";
		}
};

#endif /* TRUCK_H_ */
